from interaction import Interaction

# Lesson 2 Interaction Derived Class (Primitive Type Interaction)
class Interaction20(Interaction):

    def __init__(self, experiment, result, valence):
        super().__init__(experiment, result, valence)

    #Extract earlier Interaction
    @classmethod
    def getEnactedInteraction(cls, experiment, result):
        key = experiment + result
        interaction = cls.dictInteraction[key] if key in cls.dictInteraction else None
        return interaction

    #Store new Interaction
    @classmethod
    def createPrimitiveInteraction(cls, experiment, result, valence):
        key = experiment + result
        if key not in cls.dictInteraction:
            inter = Interaction20(experiment, result, valence)
            cls.dictInteraction[key] = inter